//1.导入vue和router包
import Vue from 'vue';
import VueRouter from 'vue-router';
import Layout from '@/page/index/index.vue';

import Warehouse from '@/views/warehouse/index.vue';

//2.调用Vue.use()函数，把 VueRouter 安装为 Vue 的插件
Vue.use(VueRouter);

//3.创建路由的示例对象

const routes = [
  {
    path: '/demo',
    component: Layout,
    redirect: '/demo/Warehouse',
    children: [
      {
        path: '/demo/Warehouse',
        component: Warehouse
      }
    ]
  },
  { path: '/', redirect: '/demo' }
];

const router = new VueRouter({ routes });

//4.向外共享路由示例对象
export default router;
